package com.fa4j.product.item.convert;

import com.fa4j.common.base.convert.CommonConvertor;
import com.fa4j.common.base.convert.ConverterConfig;
import com.fa4j.product.item.model.Item;
import com.fa4j.product.item.model.ItemCreateCmd;
import com.fa4j.product.item.model.ItemModifyCmd;
import com.fa4j.product.item.model.ItemSpec;
import com.fa4j.product.stock.model.StockSaveCmd;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

@Mapper(config = ConverterConfig.class)
public interface ItemConverter extends CommonConvertor<Item, ItemCreateCmd, ItemModifyCmd> {

    @Mapping(target = "itemId", source = "id")
    @Mapping(target = "specStockList", source = "specList")
    StockSaveCmd toSaveStockCmd(Item entity);


    @Mapping(target = "specId", source = "id")
    @Mapping(target = "quantity", source = "stockQuantity")
    StockSaveCmd.SpecStock toSpecStock(ItemSpec spec);
}

